package com.woniu.rabbit.work_model.consumer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

// 消费者
@Slf4j
@Component
public class WorkConsumer {
    // 1号消费者
    // concurrency = "5" ，设置 并发数量，最多并发 5 个线程处理消息
    @RabbitListener(queues = "work.queue")
    public void consumer01(String msg) {
        log.info("消费者1号，接收到消息：{}", msg);
    }

    // 2号消费者
    @RabbitListener(queues = "work.queue")
    public void consumer02(String msg) {
        log.info("消费者2号，接收到消息：{}", msg);
    }
}
